home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C & C++ Multimedia Cyber Classroom
/
C and C++ Multimedia Cyber Classroom (Prentice Hall) (1998).iso
/
src
/
fig11_18.jar
/
Ch11
/
Fig11_18
/
Fig11_18.cpp
Wrap
C/C++ Source or Header
|
1997-10-29
|
338b
|
23 lines
// fig11_18.cpp
// Demonstrating the width member function
#include <iostream.h>
int main()
{
int w = 4;
char string[ 10 ];
cout << "Enter a sentence:\n";
cin.width( 5 );
while ( cin >> string ) {
cout.width( w++ );
cout << string << endl;
cin.width( 5 );
}
return 0;
}